Expand description

Lorem ipsum generator.

This crate generates pseudo-Latin lorem ipsum placeholder text. The traditional lorem ipsum text start like this:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

This text is in the LOREM_IPSUM constant. Random looking text like the above can be generated using the lipsum function. The function allows you to generate as much text as desired and each invocation will generate different text.

The random looking text is generated using a Markov chain of order two, which simply means that the next word is based on the previous two words in the input texts. The Markov chain can be used with other input texts by creating an instance of MarkovChain and calling its learn method.

Structs

Simple order two Markov chain implementation.

Never-ending iterator over words in the Markov chain.

Constants

The first book in Cicero’s work De finibus bonorum et malorum (“On the ends of good and evil”). The lorem ipsum text in LOREM_IPSUM is derived from part of this text.

The traditional lorem ipsum text as given in Wikipedia. Using this text alone for a Markov chain of order two doesn’t work very well since each bigram (two consequtive words) is followed by just one other word. In other words, the Markov chain will always produce the same output and recreate the lorem ipsum text precisely. However, combining it with the full text in LIBER_PRIMUS works well.

Functions

Generate n words of lorem ipsum text. The output will always start with “Lorem ipsum”.

Generate n words of lorem ipsum text. The output will always start with “Lorem ipsum”. The seed makes the sequence deterministic.

Generate a short lorem ipsum text with words in title case.

Generate n random words of lorem ipsum text.

Generate n random words of lorem ipsum text. The seed makes the sequence deterministic.

Type Definitions

A bigram is simply two consecutive words.